<!DOCTYPE html>
<html lang="zn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>昼夜交替</title>
    <link rel="stylesheet" href="sun.css">
</head>

<body>
    <div class="sun"></div>
    <div class="moon"></div>
    <div class="sea"></div>
</body>
<script>
    window.addEventListener('mousemove', (e) => {
        let percentAge = (100 - e.clientX / window.innerWidth * 100)
        var ssss = `inset(0px ${percentAge}% 0px 0px)`

        document.querySelector(".sun").style.clipPath = ssss
    })
</script>

</html>